package main_package;

import java.io.BufferedReader;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.Date;

import som_alg.Alg;
import som_alg.InputVector;

/**
 * this is the main class
 */
public class Main 
{

	/**
	 * @param args
	 */
	public static void main(String[] args)
	{
		String str;
		FileReader fr = null;
		BufferedReader br = null;
		InputVector vec;
		ArrayList<InputVector> inputs;

		try 
		{
			// getting the input
			fr = new FileReader("input.txt");
			br = new BufferedReader(fr);

			String[] values = null;

			inputs = new ArrayList<InputVector>();

			// as long as the file has more lines to read
			while ((str = br.readLine()) != null)
			{
				// Separate the data of the txt file (with tabs)
				values = str.split("	");

				vec = new InputVector(Integer.parseInt(values[0]), values[1]);
				// update the data from the file
				inputs.add(vec);
			}


			fr.close();
			br.close();

			System.out.println(new Date());

			//create alg class and active her start funcion
			Alg alg = new Alg(inputs);
			alg.run_alg();

			System.out.println(new Date());

		}
		catch (Exception e)
		{
			e.printStackTrace();
			System.out.println("problem");
		}
	}

}
